package lianxi6;
//主函数
public class TestMain {
    public static void main(String[] args) {
        Student[] stus = new Student[5];
        String[] name = {"张三","李四","王五","赵六","宋七"};
        int num ;
        for (int i = 0; i < name.length; i++) {
            num = (int) (Math.random() * 3) + 1;
            switch (num) {
                case 1:
                    stus[i] = new englishDept(randomId(),name[i],randomSex(),randomAge(),randomNum(),randomNum(),randomNum());break;
                case 2:
                    stus[i] = new computerDept(randomId(),name[i],randomSex(),randomAge(),randomNum(),randomNum(),randomNum(),randomNum());break;
                case 3:
                    stus[i] = new literatureDept(randomId(),name[i],randomSex(),randomAge(),randomNum(),randomNum(),randomNum(),randomNum());break;
            }
            System.out.println(stus[i]);
        }

    }
    //随机获取学号
    public static String randomId(){
        String sid="";
        for(int i=0;i<6;i++){
            sid += (int)(Math.random()*10);
        }
        return sid;
    }
    //随机性别
    public static String randomSex(){
        String[] sex={"男","女"};
        return sex[(int)(Math.random()*sex.length)];
    }
    //随机年龄
    public static int randomAge(){
        return (int)(Math.random()*4)+18;
    }
    //随机数
    public static double randomNum(){
        return Math.random()*100;
    }
}
